import { Rectangle } from "../math";
import { Behaviour } from "./Behaviour";
import { Serialized } from "./Serialized";
import { AbstractRenderer } from "./AbstractRenderer";


export class TextRenderer extends Behaviour implements AbstractRenderer {

    @Serialized('textInput')
    color = '#000000';
    @Serialized('textInput')
    text = '';
    bounds = new Rectangle();

    render(context: CanvasRenderingContext2D) {
        context.save();
        context.fillStyle = this.color;
        context.font = "25px Arial";
        context.fillText(this.text, 0, 20);
        context.restore();
    }


    getBounds() {
        this.bounds.width = 100;
        this.bounds.height = 20;
        return this.bounds;
    }
}
